## 段落对齐
from docx import Document
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
docx =Document()

p1 = docx.add_paragraph(text='左对齐')
p2 = docx.add_paragraph(text='右对齐')
p3 = docx.add_paragraph(text='居中对齐')
p4 = docx.add_paragraph(text='两端对齐')
p5 = docx.add_paragraph(text='分散对齐')

p1.alignment = WD_PARAGRAPH_ALIGNMENT.LEFT
p2.alignment = WD_PARAGRAPH_ALIGNMENT.RIGHT
p3.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
p4.alignment = WD_PARAGRAPH_ALIGNMENT.JUSTIFY
p5.alignment = WD_PARAGRAPH_ALIGNMENT.DISTRIBUTE

docx.save(r'D:\Desktop\word\a.docx')